package com.example.demo.config;

import com.example.demo.bean.Bean2;
import com.example.demo.bean.BeanA;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.TimeUnit;

@Configuration
public class BeanConfig {


    @Bean(bootstrap = Bean.Bootstrap.BACKGROUND)
    public BeanA beanA(){
        try {
            TimeUnit.SECONDS.sleep(5);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        return new BeanA();
    }

    @Bean(bootstrap = Bean.Bootstrap.BACKGROUND)
    public Bean2 bean2(){
        try {
            TimeUnit.SECONDS.sleep(5);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        return new Bean2();
    }
}
